package com.h.ioc.controller;

import com.h.ioc.model.DbTypes;
import com.h.ioc.model.Person;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
public class YmlController {

    @Value("${my.key3}")
    private Integer myKey3;

    @Value("${my.key4}")
    private boolean myKey4;

    @Value("${person.id}")
    private Integer id;
    @Autowired
    private Person person;

    //这个获取不了
//    @Value("${dbtypes.map}")
//    private Map<String,String> map;

    @Autowired
    private DbTypes dbTypes;

    @PostConstruct
    public void init() {
        System.out.println("读取的配置文件my.key3 = " + myKey3);
        System.out.println("读取的配置文件my.key4 = " + myKey4);
        System.out.println(id);
        System.out.println(person);
//        System.out.println(map);
        System.out.println(dbTypes);
    }
}
